<!--
 * @Author: your name
 * @Date: 2022-04-02 11:43:08
 * @LastEditTime: 2022-04-02 13:43:50
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \geyao\geyao\常见面试题实现两栏布局220402.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>实现两栏布局</title>
  <style>
    .outer {
      height: 100px;
    }

    .left {
      float: left;
      width: 200px;
      height: 100%;
      background: lightcoral;
    }

    .right {
      overflow: auto;
      height: 100%;
      background: lightseagreen;
    }
  </style>
</head>

<body>
  <div class="outer">
    <div class="left">左侧</div>
    <div class="right">右侧</div>
  </div>
  <script>
    //同样利用浮动，左边元素宽度固定 ，设置向左浮动。右侧元素设置 overflow: hidden; 这样右边就触发了 BFC ，BFC 的区域不会与浮动元素发生重叠，所以两侧就不会发生重叠。
  </script>
</body>

</html>